package com.zd.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/login")
public class LoginController {
	@RequestMapping("/login")
	public String login(HttpServletRequest request){
//		System.out.println(request.getRequestURI());
		return "login";
	};
	
	@RequestMapping("/submit")
	public String submit(String username,String pwd,HttpServletRequest request){
		HttpSession session = request.getSession();
		if(username != null){
			session.setAttribute("username", username);
			return "redirect:/list";
		}else{
			return "redirect:/login/login";
		}
		
	}
	
}
